import 'package:flutter/material.dart';
import 'package:oi_ai_tool/common/IconFontIcons.dart';
import 'package:oi_ai_tool/route/oi_route.dart';
import 'package:oi_ai_tool/util/storage.dart';
import 'package:oi_ai_tool/widgets/toast.dart';

class SettingViewConfig {
  static final List settingList = [
    {
      'icon': Icons.token_outlined,
      'title': "AI 配置",
      'onTap': () {
        OiRoute.go(Routes.Token);
      }
    },
    {
      'icon': Icons.delete,
      'title': "清除对话",
      'onTap': () async {
        bool removeok = await OiStorage.remove(StoreageKey.CHAT_LIST);
        if (removeok) {
          OiToast.msg("清除成功");
          OiRoute.off(Routes.Initials);
        } else {
          OiToast.error("清除失败");
        }
      },
    },
    {
      'icon': IconFontIcons.iconClearFolder,
      'title': "清除历史记录",
      'onTap': () async {
        bool removeok = await OiStorage.remove(StoreageKey.ARCHIVE_LIST);
        if (removeok) {
          OiToast.msg("清除历史记录成功");
          OiRoute.off(Routes.Initials);
        } else {
          OiToast.error("清除失败");
        }
      },
    },
    {
      'icon': IconFontIcons.iconProxy,
      'title': "代理配置",
      'onTap': () async {
        OiToast.msg("配置成功");
        OiRoute.off(Routes.Initials);
      },
    },
  ];
}
